/**
 * Copyright (C) 2010 Cloudfarming <info@cloudfarming.nl>
 *
 * Licensed under the Eclipse Public License - v 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.eclipse.org/legal/epl-v10.html
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package nl.cloudfarming.client.model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Timon Veenstra
 */



@NamedQueries(value = {
    @NamedQuery(name = FieldFile.Q_FIND_FIELDFILE_BY_FILENAME_AND_CHECKSUM, query = "select f from FieldFile f where f.fileName = :fileName and f.checksum = :checksum")  
})
@Entity
@Table(name = "FIELD_FILE")
public class FieldFile implements Serializable, Persistable
{
    public static final String Q_FIND_FIELDFILE_BY_FILENAME_AND_CHECKSUM = "findFieldFileByNamAndChecksum";
    
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name="ID")
    private long id;

    @Column(name="FILENAME")
    private String fileName;

    @Column(name="MD5_CHEKSUM")
    private String checksum;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name="FILE_CREATED")
    private Date fileCreated;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name="FILE_READ")
    private Date fileRead;

    public Date getFileRead() {
        return fileRead;
    }

    public void setFileRead(Date fileRead) {
        this.fileRead = fileRead;
    }

    public String getChecksum() {
        return checksum;
    }

    public void setChecksum(String checksum) {
        this.checksum = checksum;
    }

    public Date getFileCreated() {
        return fileCreated;
    }

    public void setFileCreated(Date fileCreated) {
        this.fileCreated = fileCreated;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public long getId() {
        return id;
    }

}
